// pages/movie-detail/movie-detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    movieDetailList: {}
  },
  // 实现点击图片放大，运用微信api接口，wx.previewImage
  onReviewImage (e) {
    var imageUrl = e.currentTarget.dataset.imageUrl
    wx.previewImage({
      urls: [imageUrl],
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var This = this
    const movieId = options.movieId
    wx.request({
      url: 'https://api.douban.com/v2/movie/subject/'+ movieId +'?apikey=0df993c66c0c636e29ecbb5344252a4a',
      header:{
        "Content-Type":"json"
      },
      success (data) {
        var movieDetail = data.data
        var content = movieDetail.summary.replace(/\\n/g, '\n')
        movieDetail.summary = content
        This.setData({
          movieDetailList: movieDetail
        })
        console.log(This.data.movieDetailList)
      }
    })
   
  },
})